import time
import cherrypy
import logging
from textile                import textile
from cgi                    import escape

log = logging.getLogger("kaizen.utils")

def textilize(unicodeStr):
    if unicodeStr:
        start = time.time()
        log.debug("Textilize " +unicodeStr)
        text =  textile(escape(unicodeStr).encode('utf-8'), encoding='utf-8', output='utf-8')
        log.debug("---textilize done in " +str(time.time()-start) + " seconds.")
        return text
    return '-no content-'

